package com.minglv.mini.service.impl;

import com.minglv.mini.domain.Banner;
import com.minglv.mini.mapper.BannerMapper;
import com.minglv.mini.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
//@DataSource(DataSourceType.SLAVE)
public class BannerServiceImpl implements IBannerService {

    @Autowired
    private BannerMapper bannerMapper;

    @Override
//
    public Map getList() {
        Map data = new HashMap();
        List<Map> list = bannerMapper.getList(1);

        List<Map> menuList = new ArrayList<>();
        Map meun1 = new HashMap();
        meun1.put("icon","/static/index/act.png");
        meun1.put("title","活动");
        meun1.put("path","/pages/active/active");
        meun1.put("jump","switch");
        meun1.put("checkLogin",false);
        menuList.add(meun1);

        Map meun2 = new HashMap();
        meun2.put("icon","/static/index/shop.png");
        meun2.put("title","兑换");
        meun2.put("path","/pages/shop/shop");
        meun2.put("jump","jump");
        meun2.put("checkLogin",false);
        menuList.add(meun2);

        Map meun3 = new HashMap();
        meun3.put("icon","/static/index/add.png");
        meun3.put("title","发布需求");
        meun3.put("path","/pages/fabu/need");
        meun3.put("jump","jump");
        meun3.put("checkLogin",true);
        menuList.add(meun3);

        Map meun4 = new HashMap();
        meun4.put("icon","/static/index/user.png");
        meun4.put("title","我的");
        meun4.put("path","/pages/user/user");
        meun4.put("jump","switch");
        meun4.put("checkLogin",false);
        menuList.add(meun4);

        data.put("list",list);
        data.put("count",list.size());
        data.put("menuList",menuList);
        data.put("checkVersion",true);
        data.put("apiversion","20240203");
        data.put("isOnline",true);
        data.put("showKefy",true);
        data.put("shareTitle","好律师都在名律堂");

        return data;
    }

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public Banner selectBannerById(Long id)
    {
        return bannerMapper.selectBannerById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param banner 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<Banner> selectBannerList(Banner banner)
    {
        return bannerMapper.selectBannerList(banner);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param banner 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertBanner(Banner banner)
    {
        return bannerMapper.insertBanner(banner);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param banner 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateBanner(Banner banner)
    {
        return bannerMapper.updateBanner(banner);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteBannerByIds(Long[] ids)
    {
        return bannerMapper.deleteBannerByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteBannerById(Long id)
    {
        return bannerMapper.deleteBannerById(id);
    }
}
